﻿using AutoMapper;
using Domain.Entity;
using Domain.Entity.Fy;
using Domain.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Application.EMRService
{
    public class EMRService : IEMRService
	{
		private readonly IEMRRepository rEM;
		private readonly IMapper mapper;

		public EMRService(IEMRRepository rEM, IMapper mapper)
		{
			this.rEM = rEM;
			this.mapper = mapper;
		}

		public Task<bool> AddEMR(EMRServiceDto mR)
		{
			EMR eMR = mapper.Map<EMR>(mR);
			return rEM.AddEMR(eMR);
		}

		public Task<bool> DeleteEMR(int id)
		{
			return rEM.DeleteEMR(id);
		}

		public List<EMR> GetEMR()
		{
			return rEM.GetEMR();
		}

		public EMRFy GetEMRFY(int currentPage, int pageSize)
		{
			return rEM.GetEMRFY(currentPage, pageSize);
		}

		public Task<bool> UpdateEMR(EMRServiceDto mR)
		{
			EMR eRM = mapper.Map<EMR>(mR);
			return rEM.UpdateEMR(eRM);
		}


	}
}
